#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int cmp_char(const void *a, const void *b) {
    char ca = *(const char*)a;
    char cb = *(const char*)b;
    if (ca < cb) return -1;
    if (ca > cb) return 1;
    return 0;
}

int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        int n;
        scanf("%d", &n);
        char s[100010];
        scanf("%s", s);

        int c0[26] = {0};
        int c1[26] = {0};

        for (int i = 0; i < n; i++) {
            char ch = s[i];
            if (islower(ch)) {
                int x = ch - 'a';
                c0[x]++;
            } else if (isupper(ch)) {
                int x = ch - 'A';
                c1[x]++;
            }
        }

        int form[26];
        for (int x = 0; x < 26; x++) {
            if (c1[x] >= c0[x]) {
                form[x] = 1;
            } else {
                form[x] = 0;
            }
        }

        char A[100010];
        int lenA = 0;
        int has[26] = {0};

        for (int i = 0; i < n; i++) {
            char ch = s[i];
            if (islower(ch)) {
                int x = ch - 'a';
                if (form[x] == 0) {
                    A[lenA++] = ch;
                    has[x] = 1;
                }
            } else if (isupper(ch)) {
                int x = ch - 'A';
                if (form[x] == 1) {
                    A[lenA++] = ch;
                    has[x] = 1;
                }
            }
        }

        char B[30];
        int lenB = 0;
        for (int x = 0; x < 26; x++) {
            if (!has[x]) {
                if (form[x] == 1) {
                    B[lenB++] = 'A' + x;
                } else {
                    B[lenB++] = 'a' + x;
                }
            }
        }
        qsort(B, lenB, sizeof(char), cmp_char);

        char result[100050];
        int iA = 0, iB = 0, ires = 0;
        while (iA < lenA || iB < lenB) {
            if (iB == lenB) {
                while (iA < lenA) {
                    result[ires++] = A[iA++];
                }
                break;
            }
            if (iA == lenA) {
                while (iB < lenB) {
                    result[ires++] = B[iB++];
                }
                break;
            }
            if (B[iB] <= A[iA]) {
                result[ires++] = B[iB++];
            } else {
                result[ires++] = A[iA++];
            }
        }
        result[ires] = '\0';

        printf("%s\n", result);
    }
    return 0;
}